<#import "/META-INF/spring.ftl" as spring />
<#import "/META-INF/mspring.ftl" as mspring />
<#include "../inc/header.ftl" />
<form id="attachmentForm" name="attachmentForm" action="${base}/admin/attachment/list" method="POST">
	<@spring.bind "attachmentPage" />
	<!-- pagination parameter -->
	<@spring.formHiddenInput path="attachmentPage.pageNo" />
	<@spring.formHiddenInput path="attachmentPage.totalPages" />
	<@spring.formHiddenInput path="attachmentPage.totalCount" />
	<!-- sorter parameter -->
	<@spring.formHiddenInput path="attachmentPage.sortEnable" />
	<@spring.formHiddenInput path="attachmentPage.sort.field" />
	<@spring.formHiddenInput path="attachmentPage.sort.order" />
	<table class="dtable" cellspacing="0" cellpadding="0">
		<tr>
			<th onclick="sortField(this, 'attachmentForm', 'id');" id='id_sort'>编号</th>
			<th onclick="sortField(this, 'attachmentForm', 'user');" id='user_sort'>用户编号</th>
			<th onclick="sortField(this, 'attachmentForm', 'ftype');" id='ftype_sort'>关联类型</th>
			<th onclick="sortField(this, 'attachmentForm', 'fkey');" id='fkey_sort'>关联编号</th>
			<th onclick="sortField(this, 'attachmentForm', 'size');" id='size_sort'>大小</th>
			<th onclick="sortField(this, 'attachmentForm', 'uploadTime');" id='uploadTime_sort'>上传时间</th>
			<th>操作</th>
		</tr>
		<#if attachmentPage??>
			<#list attachmentPage.result as item>
				<#assign tdClass = "odd">
				<#if item_index%2 == 0>
					<#assign tdClass = "even">
				</#if>
				<tr>
					<td class="${tdClass}">${item.id} </td>
					<td class="${tdClass}">${item.user!""} </td>
					<td class="${tdClass}">${item.ftype!""} </td>
					<td class="${tdClass}">${item.fkey!""} </td>
					<td class="${tdClass}">${item.size!""} </td>
					<td class="${tdClass}">${item.uploadTime} </td>
					<td class="${tdClass}">
						<a href="${base}/admin/attachment/view?id=${item.id}">查看</a> | <a href="javascript:deleteAttach(${item.id});">删除</a>
					</td>
				</tr>
			</#list>
		</#if>
	</table>
	<table style="width:100%;">
		<tr>
			<td>
				<@mspring.pagingnavigator page=attachmentPage form_id="attachmentForm" />
			</td>
		</tr>
	</table>
</form>
<script type="text/javascript">
	function deleteAttach(id){
		if(confirm("确认删除该附件吗？")){
			mlog.form.submitForm('attachmentForm', '${base}/admin/attachment/delete?id=' + id);
		}
	}
</script>
<#include "../inc/footer.ftl" />